package com.softserveinc.interactive_board.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.softserveinc.interactive_board.dao.InteractiveBoardDAO;
import com.softserveinc.interactive_board.domain.User;
import com.softserveinc.interactive_board.domain.UserType;

@Service
public class InteractiveBoardServiceImpl implements InteractiveBoardService {
	
	
	@Transactional
	public List<UserType> getAllUserTypes() {
		return interactiveBoardDAO.getAllUserTypes();
	}
	
	
	@Transactional
	public List<UserType> getRegistratebleUserTypes() {
		return interactiveBoardDAO.getRegistratebleUserTypes();
	}
	
	
	@Transactional
	public List<User> getAllUsers() {
		return interactiveBoardDAO.getAllUsers();
	}
		
	
	@Transactional
	public List<User> getUser(Long id) {
		return interactiveBoardDAO.getUser(id);
	}
	
	@Transactional
	public boolean addUser(final User user) {
		return this.interactiveBoardDAO.addUser(user);
	}
	

	@Transactional
	public void updateUser(User user) {
		this.interactiveBoardDAO.updateUser(user);
	}
	
	
	@Transactional
	public void deleteUser(final Long userId) {
		this.interactiveBoardDAO.deleteUser(userId);
	}

	
	protected InteractiveBoardDAO interactiveBoardDAO;

	@Autowired
	@Qualifier("interactiveBoardDAOImpl")
	public void setInteractiveBoardDAO(InteractiveBoardDAO interactiveBoardDAO) {
		this.interactiveBoardDAO = interactiveBoardDAO;
	}
}
